//SamXIAO
#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926
#define   SQUARE(x) ((x)*(x))
//double SQUARE(double x) { return x*x;}
#define N_MAX 987654321
#define N_MIN -N_MAX
int f[286][102];

void w1()
{
	int n, m, x, y, ans=0, cnt=0;
	scanf("%d%d", &n, &m);
	//scanf("%d%d", &x, &y);
 	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++)
			scanf("%d", &f[i][j]);
  }
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			scanf("%d", &x);
			f[i][j] += x;
		}
  }
  
 	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++)
			printf("%d ", f[i][j]);
		printf("\n");
  }

}

int main()
{
	w1();
  return 0;
}
